package com.kaigejava.command.command.impl.stereo.vol;

import com.kaigejava.command.command.ICommandInterface;
import com.kaigejava.command.sdk.StereoAPI;

/**
 * Created by kaigejava on 2019/8/30.
 * 把音响音量减小
 */
public class StereoSubVolCommand implements ICommandInterface {
    private StereoAPI setreo;

    public StereoSubVolCommand(StereoAPI stereo){
        this.setreo = stereo;
    }

    @Override
    public void execute() {
        int vol=	setreo.GetVol();
        if(vol>0)
        {
            setreo.downVolume(--vol);
        }

    }

    @Override
    public void undo() {
        int vol=	setreo.GetVol();
        if(vol<11)
        {
            setreo.AddVolume(++vol);
        }
    }
}
